<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>易买网</title>
</head>
<body>
	<c:if test="${sessionScope.easybuyUserLogin==null}">
	<c:redirect url="${request.getContextPath()}/pre/Login.jsp"></c:redirect>
	</c:if>
	<%
		List list = (List) request.getAttribute("list");
		if (list == null) {
			String conPath = request.getContextPath();
			out.print("<script>location.href = '" + conPath + "/EasybuyUserServlet?action=user'</script>");

		}
	%>

	<!--Begin Header Begin-->
	<%@ include file="/common/pre/header.jsp"%>

	<%@ include file="/common/backend/searchBar.jsp"%>
	<!--End Header End-->
	<div class="i_bg bg_color">
		<!--Begin 用户中心 Begin -->
		<div class="m_content">
			<!-- 左侧Begin -->
			<%@ include file="/common/backend/leftBar.jsp"%>

			<!-- 右侧动态加载Begin -->
			<div class="m_right">
				<input type="text" value="${requestScope.userid }" style="display:none;" name="userid" id="userid"/>
				<c:if test="${requestScope.userid == 0}">
					<div class="mem_tit">权限管理</div>
					<c:forEach var="item" items="${requestScope.menuBtn }">
						${item.mbtn }
					</c:forEach>
				</c:if >
				<c:if test="${requestScope.userid != 0}">
					<div class="mem_tit">给用户（${requestScope.userid }）分配权限</div><br/>
					<a href="javascript:;" class="add_b" onclick="setAll()">全选</a>
					<a href="javascript:;" class="add_b" onclick="setNo()">取消全选</a>
					<a href="javascript:;" class="add_b" onclick="setOthers()">反选</a>
				</c:if >
				<br/><br/>
				<table border="0" class="order_tab"
					style="width: 930px; text-align: center; margin-bottom: 30px;"
					cellspacing="0" cellpadding="0">
					<tr>
						<td width="50"></td>
						<td width="155">权限名</td>
						<td width="155">权限标识</td>
					</tr>
					<c:forEach var="i" items="${requestScope.menulist }">
						<tr>
							<td>
								<c:if test="${requestScope.userid != 0}">
									<input type="checkbox" name="menuid" value="${i.id }"  
										<c:forEach var="o" items="${requestScope.list2 }">
											<c:if test="${o.id eq i.id }">
												checked="checked"
											</c:if >
										</c:forEach>
									 />
								</c:if >
								<c:if test="${requestScope.userid == 0}">
									<input type="radio" name="menuid" value="${i.id }">
								</c:if>
							</td>
							<td>${i.mname }</td>
							<td>${i.mfunction }</td>
						</tr>
					</c:forEach>
				</table>
				<c:if test="${requestScope.userid != 0}">
					<a href="javascript:;" class="add_b" onclick="hair()">分配权限</a>
				</c:if>
			</div>
		</div>
		<!--End 用户中心 End-->
		<!--Begin Footer Begin -->
		<%@ include file="/common/pre/footer.jsp"%>
		<!--End Footer End -->
	</div>
	<script type="text/javascript" src="${ctx}/statics/js/backend/user.js"></script>
</body>
</html>